package com.jhgk.jhcee.system.utils;

import org.apache.commons.lang3.StringUtils;

/**
 * @Description:
 * @Author: lemon_xzp
 * @Date: 2021/10/3 21:32
 */
public class TransitionUtil {
    private TransitionUtil() {

    }

    public static final char UNDERLINE = '_';

    public static String toUnderLowercase(String str) {
        if (StringUtils.isBlank(str)) {
            return null;
        }
        int len = str.length();
        StringBuilder builder = new StringBuilder(len);
        for (int i = 0; i < len; i++) {
            if (Character.isUpperCase(str.charAt(i))) {
                builder.append(UNDERLINE);
            }
            builder.append(str.charAt(i));
        }
        return new String(builder);
    }
}
